/*
Illuminator (LED drawing tool for iPhone)
Copyright (C) 2008
Nik S Denin
Ivan A Vlasov
Dmitriy A Jackovlev

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#import "ILBottomToolbar.h"

#define ICON_WIDTH 26.0
#define ICON_HEIGHT 40.0

@implementation ILBottomToolbar

- (id)initWithFrame:(CGRect)frame withImage:(UIImage *)image
{
	if ((self = [super initWithFrame:frame withImage:image]) != nil)
	{
		float x = 10.0;
		float y = (frame.size.height - ICON_HEIGHT) / 2.0;

		m_newButt = [[UIPushButton alloc] initWithFrame:CGRectMake(x, y, ICON_WIDTH, ICON_HEIGHT)];
		[m_newButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_new_0.png"] forState:0];
		[m_newButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_new_1.png"] forState:1];
		[m_newButt addTarget:m_delegate action:@selector(newImage) forEvents:UIMouseDown];
		x += (1.5 * ICON_WIDTH);

		m_saveButt = [[UIPushButton alloc] initWithFrame:CGRectMake(x, y, ICON_WIDTH, ICON_HEIGHT)];
		[m_saveButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_save_0.png"] forState:0];
		[m_saveButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_save_1.png"] forState:1];
		x += (1.5 * ICON_WIDTH);

		m_listButt = [[UIPushButton alloc] initWithFrame:CGRectMake(x, y, ICON_WIDTH, ICON_HEIGHT)];
		[m_listButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_list_0.png"] forState:0];
		[m_listButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_list_1.png"] forState:1];
		x += (6.0 * ICON_WIDTH);

		m_mailButt = [[UIPushButton alloc] initWithFrame:CGRectMake(x, y, ICON_WIDTH, ICON_HEIGHT)];
		[m_mailButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_mail_0.png"] forState:0];
		[m_mailButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_mail_1.png"] forState:1];
		[m_mailButt addTarget:m_delegate action:@selector(mailImage) forEvents:UIMouseDown];

		x += ICON_WIDTH;

		m_bombButt = [[UIPushButton alloc] initWithFrame:CGRectMake(x, y, ICON_WIDTH, ICON_HEIGHT)];
		[m_bombButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_boom_0.png"] forState:0];
		[m_bombButt setImage:[UIImage applicationImageNamed:@"toolbar_icons/icon_boom_1.png"] forState:1];
		
		[self addSubview:m_newButt];
		[self addSubview:m_saveButt];
		[self addSubview:m_listButt];
		[self addSubview:m_mailButt];
		[self addSubview:m_bombButt];
	}
	
	return self;
}

- (void)dealloc
{
	[super dealloc];
}

@end
